<template>
   <div class="management-merchant views-container">
    <div class="wlm-table">
        <div class="wlm-table-hearder-btn">
            <!-- :to="{path:'/merchant/businessAdd'}" -->
            <router-link class="wlm-text" tag="span" :to="{path:'/application/agentadd'}">
                <el-button size="small" type="primary">添加代理</el-button>
            </router-link>
        </div>
        <div class="wlm-table-header">
         <!-- :model="tableFormatData.agentlist.files" -->
            <el-form  size="small" label-width="80px" class="retail-form" label-position="right">
                <el-form-item class="filter">
                    <el-form-item label="代理名称：">
                        <!-- v-model="tableFormatData.agentlist.files.name" -->
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.agentlist.files.keywords"  placeholder="请输入名称，手机号，真实姓名" style="width:300px;"></el-input>
                    </el-form-item>
                </el-form-item>
                 <el-form-item label="" class="filter-btns">
                    <el-button v-waves type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
     </div>
       <div class="wlm-table-content">
            <el-table :ref="tableFormatData.agentlist.key"   :default-sort="{prop: 'sort', order: 'descending'}" :data="tableFormatData.agentlist.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                 <el-table-column type="selection" width="55">
                 </el-table-column>
                <el-table-column label="代理名称">
                    <template slot-scope="scope">
                      <span>{{scope.row.agentname}}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="联系方式">
                    <template slot-scope="scope">
                      <span>{{scope.row.mobile}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="到期时间">
                    <template slot-scope="scope">
                      <span>{{scope.row.endtime}}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="是否到期">
                    <template slot-scope="scope">
                      <el-tag type="success" v-if="scope.row.over==0">正常</el-tag>
                      <el-tag type="danger" v-if="scope.row.over==1">过期</el-tag>
                    </template>
                </el-table-column>
                  <el-table-column label="是否启用">
                    <template slot-scope="scope">
                      <span v-if="scope.row.status==1">是</span>
                      <span v-if="scope.row.status==0">否</span>
                    </template>
                </el-table-column>
                  <el-table-column label="操作">
                    <template slot-scope="scope">
                       <router-link class="wlm-text" tag="span" :to="{path:'/application/agentadd',query:{id:scope.row.id}}">
                        <el-button type="text">编辑</el-button>
                      </router-link>
                      <!-- <el-button type="text">管理</el-button> -->
                         <!-- <router-link class="wlm-text" tag="a" target="_blank" :to="{path:'/dashboard',query:{agent_id:$aes.encrypt(scope.row.store_user_id)}}"> -->
                         <!-- id拿来显示  -->

                         <!-- <router-link class="wlm-text" tag="a" target="_blank" :to="{path:'/dashboard',query:{h_aid:$aes.encrypt(scope.row.id),store_user_id:$aes.encrypt(scope.row.store_user_id)}}">
                  <el-button type="text">管理</el-button>
                </router-link> -->
                    </template>
                </el-table-column>
            </el-table>
             <div class="pagination-content flex-row flex-justify-b flex-align-c" style="display:flex;justify-content:space-between">
                 <el-row class="pagination-btns">
                    <el-checkbox class="check-all" true-label="1" false-label="0" v-model="tableFormatData.agentlist.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <el-button class="right-8" :disabled="isGroup" size="mini" @click="delTableList">删除</el-button>
                  </el-row>
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.agentlist.pagination.page" :page-sizes="tableFormatData.agentlist.pagination.pagesizes" :page-size.sync="tableFormatData.agentlist.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.agentlist.pagination.total : 0">
                </el-pagination>
            </div>
       </div>
    </div>
     
   </div>
</template>
<script>
import {getAgentUserList,deleteAgentUser} from '@/api/cityagent'
import waves from '@/directive/waves' // Waves directive
import mixins from '@/mixins/mixins'
// import {agentManage} from '@/api/login'
export default {
     mixins: [mixins.getters('Table')],
     name: 'agentlist',
      directives: {
    waves
  },
  data () {
      return {
          tableFormatData: {
        current: 'agentlist',
        agentlist: {
          key: 'agentlist',
          api: {
            getList: getAgentUserList,
            delList: deleteAgentUser,
            // msgConfig: {
            //   // del: {
            //   //   type: 'warning',
            //   //   msg: '此操作会删除商家的所有数据，名下所有如有正在交易的商品，删除后所产生的纠纷由服务商自身承担 如要删除请慎重操作！！'
            //   // }
            // },

          },
          tableData: [],
          otherData:{
            money_type:''
          },
          files: {
            ids: [],
            checkall:'0'
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
      }
  },
  methods:{
// store_user_id：90
// aid:152
    // guanlibnt(aid,store_user_id){
    //   agentManage({aid:aid,store_user_id:store_user_id}).then(res=>{
    //     if(res.data.code==1){
    //       console.log("sfhdsf",res)
    //     }
    //   })
    // },
  },

}
</script>
<style lang="scss" scoped>

</style>